package misa;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class InitialSolution {
	public List randInit(int dimension, int popSize, double leftBound, double rightBound){
		
		Random rand = new Random();
		
		List<List> population = new ArrayList<List>();
		for(int i=0;i<popSize;i++){
			List solution = new ArrayList();
			for(int j=0;j<dimension;j++){
				solution.add(rand.nextDouble()*(rightBound-leftBound)+leftBound);
			}
			
			population.add(solution);
		}
		
		return population;
	}
	
	public static void main(String[] args){
		InitialSolution init = new InitialSolution();
		List<List> population = init.randInit(10, 100, 3, 10);
		for(List solution:population){
			System.out.print("[");
			for(Object obj:solution){
				System.out.print(obj+"  ");
			}
			System.out.println("]");
		}
	}
	
}
